package GraphProperties;

import java.io.Serializable;

import Definitions.GraphClass;
import Utility.WorkerUtilityClass;

public class PropertiesOfGraphClass implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -4696646140897782628L;
	GraphClass myGraph;	
	int edgeType;
	

	public ShortestPathRelatedPropsClass shortestPathRelatedProps;
	public DegreeDistributionRelatedPropsClass 	degreeDistributionRelatedProps;
	public ClusteringCoefficientRelatedPropsClass 	clusteringCoefficientRelatedProps;
	public HomophilyRelatedPropsClass homophilyRelatedProps;
	public RichClubCoefficientRelatedPropsClass richClubCoefficientRelatedProps;
	public LocalAlphaRelatedPropsClass localAlphaRelatedProps;
	public AccuracyRelatedPropsClass accuracyRelatedProps;
	
	
	public PropertiesOfGraphClass(GraphClass myGraph, int edgeType)
	{
		shortestPathRelatedProps = new ShortestPathRelatedPropsClass(this);
		degreeDistributionRelatedProps = new DegreeDistributionRelatedPropsClass(this);
		clusteringCoefficientRelatedProps = new ClusteringCoefficientRelatedPropsClass(this);
		homophilyRelatedProps = new HomophilyRelatedPropsClass(this);
		richClubCoefficientRelatedProps = new RichClubCoefficientRelatedPropsClass(this);
		localAlphaRelatedProps = new LocalAlphaRelatedPropsClass(this);
		accuracyRelatedProps = new AccuracyRelatedPropsClass(this);
		this.myGraph = myGraph;
		this.edgeType = edgeType;
	}
	
	public double[] prepareForCorrelationCalculation(double[] vector, int min)
	{
		double[] ddOfTheNodes=degreeDistributionRelatedProps.degreeListOfNodes;
		double[] nonZeroFormOfTheVectorWrtDegree;
		int numberOfNonZeroElementsOfDegreesOfNodes;
		
		numberOfNonZeroElementsOfDegreesOfNodes = WorkerUtilityClass.getLengthOfTheVectorForElementLessThan(ddOfTheNodes, min);
		
		nonZeroFormOfTheVectorWrtDegree = new double[numberOfNonZeroElementsOfDegreesOfNodes];
		
		int nonZeroVectorIndex=0;
		
		 for(int i=0; i<ddOfTheNodes.length; i++)
		 {
			 if(ddOfTheNodes[i]>=min)
				 nonZeroFormOfTheVectorWrtDegree[nonZeroVectorIndex++] = vector[i];
		 }
		 return nonZeroFormOfTheVectorWrtDegree;
	}	
}
